/*
 * @Author: 
 * @Date: 2021-12-18 19:54:33
 * @LastEditTime: 2021-12-18 21:04:54
 * @FilePath: /vue3-vite2-ts-antdv/vite.config.ts
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
import vueJsx from "@vitejs/plugin-vue-jsx";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // 支持 tsx
    vueJsx(),
    Components({
      resolvers: [
        AntDesignVueResolver({
          importStyle: "less",
        }),
      ],
    }),
  ],
  css: {
    preprocessorOptions: {
      less: {
        // 自定义主题变量
        "@primary-color": "#0083FF",
        // 支持less
        javascriptEnabled: true,
      },
    },
  },
  // 配置别名
  resolve: {
    alias: [
      { find: /^@\//, replacement: `${path.resolve(__dirname, "./src")}/` },
    ],
  },
})
